{{ $page := . }}
{{ $featured := (.Resources.ByType "image").GetMatch "*featured*" }}
{{ $anchor := $page.Params.image.focal_point | default "Smart" }}

{{/* Set default titles for node pages */}}
{{ $title := .Title }}
{{ if and (not $title) .IsNode }}
{{ if eq .Type "post" }}
{{ $title = i18n "posts" }}
{{ else if eq .Type "talk" }}
{{ $title = i18n "talks" }}
{{ else if eq .Type "publication" }}
{{ $title = i18n "publications" }}
{{end}}
{{end}}

{{/* Header image */}}


{{/* Featured image */}}
{{ if and $featured (not .Params.image.preview_only) }}
{{ $image := $featured.Fill (printf "680x500 q90 %s" $anchor) }}
<div class="container split-header">
  <div class="row justify-content-center">
    <div class="col-lg-8">
        <img class="img-fluid w-100" src="{{ $image.RelPermalink }}" itemprop="image" alt="">
        {{ with $.Params.image.caption }}<span
          class="article-header-caption">{{ . | markdownify | emojify }}</span>{{ end }}
    </div>
    <div class="col-lg-8">
      <h1 itemprop="name">{{ $title }}</h1>

      {{ with $page.Params.subtitle }}
      <p class="page-subtitle">{{ . | markdownify | emojify }}</p>
      {{end}}

      {{ partial "page_metadata" (dict "page" $page "is_list" 0 "share" true) }}
      {{ partial "page_links_div.html" $page }}
    </div>
    {{else}}
    {{/* Case when page has no image */}}

    {{/* Wider container for nodes */}}
    {{ $ctnr := "article-container" }}
    {{ if $page.IsNode }}
    {{ $ctnr = "universal-wrapper" }}
    {{end}}
    <div class="{{$ctnr}} py-3">
      <h1 itemprop="name">{{ $title }}</h1>

      {{ with $page.Params.subtitle }}
      <p class="page-subtitle">{{ . | markdownify | emojify }}</p>
      {{end}}

      {{ if not .IsNode }}
      {{ partial "page_metadata" (dict "page" $page "is_list" 0 "share" true) }}
      {{ partial "page_links_div.html" $page }}
      {{end}}
      {{end}}
    </div>
  </div>
</div>